package bancosys.tec.persist.spring.transaction;

import org.springframework.transaction.support.DefaultTransactionDefinition;

import bancosys.tec.persist.authorization.AuthorizationContext;

/**
 * Extende {@link DefaultTransactionDefinition} com informacoes sobre a particao. Por default, usa {@value AuthorizationContext#hot}
 */
public class PartitionTransactionDefinition extends DefaultTransactionDefinition {

    private AuthorizationContext partition = AuthorizationContext.hot;

    private boolean pureSessionOnly = false;

    /**
     * @return {@link AuthorizationContext}
     */
    public AuthorizationContext getPartition() {
        return this.partition;
    }

    /**
     * @param partition {@link AuthorizationContext}
     */
    public void setPartition(AuthorizationContext partition) {
        this.partition = partition;
    }

    /**
     * Se true, a transacao usara uma Session do hibernate pura (sem decorators)
     * 
     * @return boolean
     */
    public boolean isPureSessionOnly() {
        return this.pureSessionOnly;
    }

    /**
     * @param pureSessionOnly boolean
     */
    public void setPureSessionOnly(boolean pureSessionOnly) {
        this.pureSessionOnly = pureSessionOnly;
    }
}
